package com.zxm.sunshineaiary.view.mydialog;

import android.content.Context;
import android.os.Bundle;
import android.view.View;

import com.zxm.sunshineaiary.activity.R;
import com.zxm.sunshineaiary.info.DateInfo;
import com.zxm.sunshineaiary.util.SystemUtil;
import com.zxm.sunshineaiary.view.calendar.datewidgetdaycell.DateWidgetDay;
import com.zxm.sunshineaiary.view.calendar.datewidgetdaycell.DateWidgetDayCell;
import com.zxm.sunshineaiary.view.mydialog.basedialog.BasDialog;

/**
 * 长按日期弹出的删除日记Dialog
 * 
 * @author Administrator
 * 
 */
public class DeleteDiaryDialog extends BasDialog {

	private DateInfo mDateInfo = null;
	private DateWidgetDay mDateWidgetDay = null;

	public DeleteDiaryDialog(Context context, DateWidgetDay dateWidgetDay,
			DateInfo dateInfo) {
		super(context);
		mDateInfo = dateInfo;
		mDateWidgetDay = dateWidgetDay;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTitileText();
	}

	protected void setTitileText() {
		dialogTitle.setText(R.string.delete_diary);
	}

	@Override
	public void onClick(View v) {
		if (v == this.confrimButton) {
			SystemUtil.deleteDiary(mContext, mDateInfo);
			mDateWidgetDay.setDiarybackgroud();
			mDateWidgetDay.invalidate();
			this.dismiss();
		}
		super.onClick(v);
	}
}
